package itdep.ui.security;

import org.springframework.util.StringUtils;

import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 34 $ $Date: 2010-06-20 09:57:55 +0000 (Sun, 20 Jun 2010) $
 */
public class SecurityBean {
	private String name;
	private String password;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String doLogin() throws IOException, ServletException {
		final ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		final RequestDispatcher dispatcher = ((ServletRequest) context.getRequest()).getRequestDispatcher("/check");
		dispatcher.forward((ServletRequest) context.getRequest(), (ServletResponse) context.getResponse());
		FacesContext.getCurrentInstance().responseComplete();
		return null;
	}

}
